﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YmtAuth.Domain.Repository;
using YmtAuth.Domain.Repository.MsSql;
using YmtAuth.Repository.MySQL;
using YmtSystem.CrossCutting;

namespace YmtAuth.Repository.MSSQL
{
   public class RepositoryDependencies
   {
       public static void ReisterRepository()
       {
           UserRepository = () => new UserRepository();
           UserLoginIpCountRepository=()=>new UserLoginIpCountEntityRepository();
           userOpSyncRepo = () => new UserOperationSyncRepository();
       }

       public static Func<IUserRepository> UserRepository
       {
           get
           {
               YmtSystemAssert.AssertArgumentNotNull(userRepoFunc, "IThirdPartyUserNeedBindMobileRepository is null");
               return userRepoFunc;
           }
           internal set
           {
               YmtSystemAssert.AssertArgumentNotNull(value, "IThirdPartyUserNeedBindMobileRepository can't null");
               userRepoFunc = value;
           }
       }

       public static Func<IUserLoginIpCountEntityRepository> UserLoginIpCountRepository
       {
           get
           {
               YmtSystemAssert.AssertArgumentNotNull(userLoginIpCountRepository, "IUserLoginIpCountEntityRepository is null");
               return userLoginIpCountRepository;
           }
           internal set
           {
               YmtSystemAssert.AssertArgumentNotNull(value, "IUserLoginIpCountEntityRepository can't null");
               userLoginIpCountRepository = value;
           }   
       }

       public static Func<IUserOperationSyncRepository> UserOpSyncRepo
       {
           get { return userOpSyncRepo; }
           internal set { userOpSyncRepo = value; }
       }

       private static Func<IUserLoginIpCountEntityRepository> userLoginIpCountRepository;
       private static Func<IUserRepository> userRepoFunc;

       private static Func<IUserOperationSyncRepository> userOpSyncRepo;
   }
}
